package com.lorenzogao.logingmodular;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

import com.lorenzogao.componentlib.service.ILoginService;

/**
 * Created by GanLanPing
 * data:2019/3/2
 * time:15:19
 * 邮箱:2508719070@qq.com
 * Description:
 */

public class LoginService implements ILoginService {

    @Override
    public void launch(Context context, String taggetClass) {
        Intent intent=new Intent(context,LoginActivity.class);
        intent.putExtra("LoginActivity",taggetClass);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }

    @Override
    public Fragment newUserFragment(FragmentManager fragmentManager, int viewId, Bundle bundle) {
         UserInfoFragment fragment=new UserInfoFragment();
         fragment.setArguments(bundle);
         fragmentManager.beginTransaction().add(viewId,fragment).commit();
        return fragment;
    }
}
